UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i4mUKvGxZ7yPBTvg8GF/fP05PJZMYtINdplz+dI5nis='
WHERE
key_id = 'afe6c24885d37b5a01e78745df46aee9aed87a2405bf0803142c4bb42f30d88e'
AND (
token = 'i4mUKvGxZ7yPBTvg8GF/fP05PJZMYtINdplz+dI5nis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)