UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TmbIlNYQxSzcF7TqlNcxNuu/aqf+1agBpQzjwZXHFwE='
WHERE
key_id = 'ce1ad244c5dbca7ee2a0faec13395af5c38385f47af4c4b42653206631d136bb'
AND (
token = 'TmbIlNYQxSzcF7TqlNcxNuu/aqf+1agBpQzjwZXHFwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)