UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HUXL0GpbXlBOwAhMeizba+sm4fqSEg1iauoEkZEAMyY=' 
WHERE 
  key_id = '2bedead7313ec26de137a74e059ad366cd4d2b585c3d5faedd889d62aa73217b' 
  AND (
    token = 'HUXL0GpbXlBOwAhMeizba+sm4fqSEg1iauoEkZEAMyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038