UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cR7NVLU2LfbtEVQNI3pOcEYXyxK6DomWXHvh9IhjgSA=' 
WHERE 
  key_id = '164b68110728e36bf41c3f7449f9ad0073ad12c9dae4c9fe34630390f9421934' 
  AND (
    token = 'cR7NVLU2LfbtEVQNI3pOcEYXyxK6DomWXHvh9IhjgSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035