UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1LI12J5prms8pqOVEq6nnES+c0/Oq4iLYONXeKDaAv4='
WHERE
key_id = '6d044df4ea45f78e500f72004eedeadc9a263ab6af870a70c0570a59c5f2a665'
AND (
token = '1LI12J5prms8pqOVEq6nnES+c0/Oq4iLYONXeKDaAv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)