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