UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YpqLe3voyyMLBY8EEAPtipdE43X+hpti4pj0I4vtoes='
WHERE
key_id = '8db75a9b808eb6808c2e1b708bf871b6a1c0ac235027df1dc1f45485a0542a9c'
AND (
token = 'YpqLe3voyyMLBY8EEAPtipdE43X+hpti4pj0I4vtoes='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)