UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u1PUCAmxR8YW9BBOScIpzotCQ+W6hcm0LUUgyH9XPak='
WHERE
key_id = '4f0c3582d724dd696503a46318a6ba89d703b0fc66398e998b37be4bb1712aab'
AND (
token = 'u1PUCAmxR8YW9BBOScIpzotCQ+W6hcm0LUUgyH9XPak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)