UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sbGf3qJ8OGOF9ov+LPpqdsO1HqCuupaPQVe/ASYuXsM=' 
WHERE 
  key_id = 'e2c39a8542bd596c82cbbc5fb14d8931ab832e11466948f96cbfd4b923699058' 
  AND (
    token = 'sbGf3qJ8OGOF9ov+LPpqdsO1HqCuupaPQVe/ASYuXsM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015