UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eKeoBCMkWLjXm5uHr3vlCJoa8nYMuCWJYs99l+E7Gmc=' 
WHERE 
  key_id = 'dfe33f52085995f031a933c493bc5e959f6231e30c7f56f002ed3c7294b10cfe' 
  AND (
    token = 'eKeoBCMkWLjXm5uHr3vlCJoa8nYMuCWJYs99l+E7Gmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042