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

Query time 0.00050