UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SEgguIVj5DoW7k63LYXQ468wwj1Jr1HzwQ1YKBN+II8='
WHERE
key_id = 'ec12f7d0b4ec17bf19b589e844ef7fa2b427d7ab1f6e2f432f5ce294b0892306'
AND (
token = 'SEgguIVj5DoW7k63LYXQ468wwj1Jr1HzwQ1YKBN+II8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)