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

Query time 0.00055