UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ANezgfXIdbUTpm8h0NmougW2pqLh+CzAKblYGfFShto=' 
WHERE 
  key_id = '2ae785f01386d5e409b6dba41b6664434c01ef24a145be752dc5ca606be69244' 
  AND (
    token = 'ANezgfXIdbUTpm8h0NmougW2pqLh+CzAKblYGfFShto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028