UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6LNPnt3QJ6tpHJeh03fIBQsRphFQqghGEVHKhN36XhQ='
WHERE
key_id = 'bd5f8f6542d71e95edab4b0a6fb0ff16a10e9c1865d01ef31ace1c72e28c2498'
AND (
token = '6LNPnt3QJ6tpHJeh03fIBQsRphFQqghGEVHKhN36XhQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)