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