UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FfUDLOzjNO3PzW0GSlAVavRHaO5pFwTvZHGVDMggwis=' 
WHERE 
  key_id = 'e676d11a8edc6a9a95782c62670987bdd9707a07599306c19b561722b08b54b2' 
  AND (
    token = 'FfUDLOzjNO3PzW0GSlAVavRHaO5pFwTvZHGVDMggwis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032