UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BDOVxKXOMDu36kJYWQx5FcgpFNY6/oS2MZjvP0oonIk='
WHERE
key_id = '33c84c8c5eeb5893f3610f5e8025a1340362470165fc5b9634a161dcf10c06a0'
AND (
token = 'BDOVxKXOMDu36kJYWQx5FcgpFNY6/oS2MZjvP0oonIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)