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