UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dnwnqsmOTOiTVBWzXaLLx4ddze+fVoxvn0LqlDfXIJA=' 
WHERE 
  key_id = '4086d6b5811c807c507389974fe9ba445cf4b0aea83cd59b78487db18c77710f' 
  AND (
    token = 'dnwnqsmOTOiTVBWzXaLLx4ddze+fVoxvn0LqlDfXIJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038