UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h2A/x/h3MRQx1A3PylY0dS0CtwiJZ16YCJDsx9Y51aw='
WHERE
key_id = '33637a76fee6e81c54a9b8008d1522f2abdc0bebd97ba651c4cc52e60519f640'
AND (
token = 'h2A/x/h3MRQx1A3PylY0dS0CtwiJZ16YCJDsx9Y51aw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)