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