UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aopx6FVAo/+nVeJBq3Kqt/dc+yI5uTiIvvzqaRzbYT4=' 
WHERE 
  key_id = '9fc9770b8f105e30ea39a916e553e94e40af718e1868ed3de50d70ea90be95f0' 
  AND (
    token = 'aopx6FVAo/+nVeJBq3Kqt/dc+yI5uTiIvvzqaRzbYT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028