UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ileo0E8lqhF5w8p5pEwJc3Yu87U47GFV/N6i16xvyi8='
WHERE
key_id = 'b417186f9744962592d5e4c0ac68673824b57d3e7120e4a9c2b8d1e8151324aa'
AND (
token = 'ileo0E8lqhF5w8p5pEwJc3Yu87U47GFV/N6i16xvyi8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)