UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o9WZsYDR0dD9BvCaPhNyZ+N2xCE6N/Bmno6EupEJbj8='
WHERE
key_id = '3ba9054257d822a37daf112e500be91569bf5e4f2e436ebfd29d947649801ed4'
AND (
token = 'o9WZsYDR0dD9BvCaPhNyZ+N2xCE6N/Bmno6EupEJbj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)