UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gJ3EQckbV8OGd5vH3EaaRUwzLYNkeoMeVnWLMtWwtZo='
WHERE
key_id = '83984462aaf852ad688c0c8bcd0d7da1e83ea90b646e9c36813e2cd11b792168'
AND (
token = 'gJ3EQckbV8OGd5vH3EaaRUwzLYNkeoMeVnWLMtWwtZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)