UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Oc8g4S7vTl0IGtLsS0wsareoeKoBuqxTPHeo71E+dC0='
WHERE
key_id = '4d481ad666f8b49358151a76fa4427578d7de4e0163110a36b48ac81d64b4719'
AND (
token = 'Oc8g4S7vTl0IGtLsS0wsareoeKoBuqxTPHeo71E+dC0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)