UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CCjBtdpYghJS1MnLaCXiGAmdrU52WyHhNim4XC+Gv7E=' 
WHERE 
  key_id = '33cb86a837686c25d7eb57698c58d5b03bb4324f473f8c2f02853578d6224cd0' 
  AND (
    token = 'CCjBtdpYghJS1MnLaCXiGAmdrU52WyHhNim4XC+Gv7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023