UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ZkrcHZOILbNcE0L+W727TyAF8OcalnSDdUJ0gAHn1o='
WHERE
key_id = 'a2c897aa1b4966edd73e49ed254716b5b743c8354b6b9bbd197d5e9a50f6d295'
AND (
token = '0ZkrcHZOILbNcE0L+W727TyAF8OcalnSDdUJ0gAHn1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)