UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XhRIc916BamnFsnofuv7CbTak5JH5JDvzSkle7+mVOo='
WHERE
key_id = '405a77dc16ac3644b582308b9d3b74d629159c8504984fe307c0c8a611dc005d'
AND (
token = 'XhRIc916BamnFsnofuv7CbTak5JH5JDvzSkle7+mVOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)