UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jit0kTms3c+lbATiKTY2+WUQ5rJawKrW8geHOqi9EAM='
WHERE
key_id = 'f3f6e13b35d7c1a8967a98aeaa8d97eb5d74643887b91cf148198b22042941e7'
AND (
token = 'Jit0kTms3c+lbATiKTY2+WUQ5rJawKrW8geHOqi9EAM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)