UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pr1k74b+TH4DGuuN2xUx1Mz7zhGu1GrmkGEfL/UbTX0=' 
WHERE 
  key_id = '2ccda566af9aca538bc9bcff26af229c820442f78e1a1770b11ed2a790b9fca1' 
  AND (
    token = 'pr1k74b+TH4DGuuN2xUx1Mz7zhGu1GrmkGEfL/UbTX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033