UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NiIWYEg/7hdk/rk2fs3cfeUR14MAP9JP5qIfwrzj4o8='
WHERE
key_id = '59bc1e2a232e530d37061e1cb0b73ffa7d9bbca47d1d287845745f60464fc13a'
AND (
token = 'NiIWYEg/7hdk/rk2fs3cfeUR14MAP9JP5qIfwrzj4o8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)