UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z4LnMQ6Xbv1QRRGWsd8NOZ/OvVsMoU+50g3lb+VHNX8='
WHERE
key_id = '02392d1f129897f6232689b57f4816740348f44a7932887056ee5cd45bd34dfb'
AND (
token = 'Z4LnMQ6Xbv1QRRGWsd8NOZ/OvVsMoU+50g3lb+VHNX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)