UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REdf4R7hKRJVfkebeEat3OZxZxUJv5H60Do4dG4eIWA=' 
WHERE 
  key_id = '1bbe31527f1c1054cdde28d2007adae3caf83e5284bb54063d128b8867ae9e1a' 
  AND (
    token = 'REdf4R7hKRJVfkebeEat3OZxZxUJv5H60Do4dG4eIWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024