UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GPjM1koY8OF1yL0ual/QDfd9FreiiT/Kupt7ut4CEU4='
WHERE
key_id = 'fec72eda0b4c60906664488a605fc82650ea9a545f1e2efb2bff68e95e59ceef'
AND (
token = 'GPjM1koY8OF1yL0ual/QDfd9FreiiT/Kupt7ut4CEU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)