UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yPTtb2vsXUEg7MD1eiPp/YRjf7PKhivj/w1UwtpIg3w='
WHERE
key_id = '2147bcf58f6fe745c29fef7b88fc8842e05bb3699155a1e0898a231282bc9a83'
AND (
token = 'yPTtb2vsXUEg7MD1eiPp/YRjf7PKhivj/w1UwtpIg3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)