UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1Gh1tGocw3Qe73PumXZvqIj7Le5jGSgpUyZY1dgKt9s='
WHERE
key_id = 'b7f9d97303846bc06757af8f000038c048b638e6c9c1bd417fd3dfbefcf99081'
AND (
token = '1Gh1tGocw3Qe73PumXZvqIj7Le5jGSgpUyZY1dgKt9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)