UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AoJj9jOdd5gXY63Bx4nq1p2yQ8KaCzjujSxxu01hbaw='
WHERE
key_id = 'd204d88ee35902ed73f488ea650cc3c2c92e19a9ae43f98edb985c75c025b4a5'
AND (
token = 'AoJj9jOdd5gXY63Bx4nq1p2yQ8KaCzjujSxxu01hbaw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)