UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'efMmTQBBlB3UDQw76mnQcs1VTB3MCbNTAwT2GzM4h+Q=' 
WHERE 
  key_id = 'a69015dbc96eb08bfa5ef0d47e3d140954e7c65d7c393ba988b39977ff1bdadf' 
  AND (
    token = 'efMmTQBBlB3UDQw76mnQcs1VTB3MCbNTAwT2GzM4h+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034