UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8nDb2ryehMUrCMkRpJRoJ5xVHt+ssZL9d28uVg9cZww='
WHERE
key_id = 'b1c77a97783d8cf2c3072db1f5d2dcae44cf290da8369a2227b7a4ae081868db'
AND (
token = '8nDb2ryehMUrCMkRpJRoJ5xVHt+ssZL9d28uVg9cZww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)