UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'do7cI0o70lcCHD3NNth7z9DhNQ3Y73+InrWd1xQgXT8='
WHERE
key_id = '607f4139bd161989bc63eed6100358049a376b0189b5c162d8ae810d9cb38894'
AND (
token = 'do7cI0o70lcCHD3NNth7z9DhNQ3Y73+InrWd1xQgXT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)