UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oFWddnJafaXn+ujoYbcmCnKxITTE6IzUc8uYEEnubOI=' 
WHERE 
  key_id = '5e94bdf1f63d1e54f4ff71ddee54b5b2f930d5d7f3cc79a3e2056c06235809cb' 
  AND (
    token = 'oFWddnJafaXn+ujoYbcmCnKxITTE6IzUc8uYEEnubOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050