UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9SYGGK82AtkE5Dv5YmwTPg940DefkieaZNDBu+rg6M0=' 
WHERE 
  key_id = 'b8fb1a55fa0e17ac577079be83501beb4ae0350e43b2be8f29186c4939da4b95' 
  AND (
    token = '9SYGGK82AtkE5Dv5YmwTPg940DefkieaZNDBu+rg6M0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035