UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3x1p+nUKWCHcGuvXQ4eEZ3TEdI0EwSdF14RGpHC1ELc='
WHERE
key_id = '31daba150f638e83963457e0478644b2e6540fb847e41bd8b1daf16b2c722ff8'
AND (
token = '3x1p+nUKWCHcGuvXQ4eEZ3TEdI0EwSdF14RGpHC1ELc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)